import request from '@/utils/request'

// 封装一个获取部门列表的接口
// 像这种没有参数的直接这样写，写起来更间接
export const deptListAPI = () => request.get('/company/department')

// 封装一个删除部门列表的接口
export const delDeptAPI = (id) => request.delete(`/company/department/${id}`)

// 封装一个新增部门里列表的接口
export const addDeptAPI = (data) => {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 封装一个部门详情的接口
export const deptDetailAPI = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

// 封装一个修改部门详情的接口
export const editDeptAPI = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
